/**
 */
package OBSL.impl;

import OBSL.MaterialAssociationLink;
import OBSL.OBSLPackage;
import OBSL.RoleIndividual;
import RefOntoUML.MaterialAssociation;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Material Association Link</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link OBSL.impl.MaterialAssociationLinkImpl#getMaterialAssociation <em>Material Association</em>}</li>
 *   <li>{@link OBSL.impl.MaterialAssociationLinkImpl#getEnd1 <em>End1</em>}</li>
 *   <li>{@link OBSL.impl.MaterialAssociationLinkImpl#getEnd2 <em>End2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MaterialAssociationLinkImpl extends MinimalEObjectImpl.Container implements MaterialAssociationLink {
	/**
	 * The cached value of the '{@link #getMaterialAssociation() <em>Material Association</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaterialAssociation()
	 * @generated
	 * @ordered
	 */
	protected MaterialAssociation materialAssociation;

	/**
	 * The cached value of the '{@link #getEnd1() <em>End1</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnd1()
	 * @generated
	 * @ordered
	 */
	protected RoleIndividual end1;

	/**
	 * The cached value of the '{@link #getEnd2() <em>End2</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnd2()
	 * @generated
	 * @ordered
	 */
	protected RoleIndividual end2;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MaterialAssociationLinkImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return OBSLPackage.Literals.MATERIAL_ASSOCIATION_LINK;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MaterialAssociation getMaterialAssociation() {
		if (materialAssociation != null && materialAssociation.eIsProxy()) {
			InternalEObject oldMaterialAssociation = (InternalEObject)materialAssociation;
			materialAssociation = (MaterialAssociation)eResolveProxy(oldMaterialAssociation);
			if (materialAssociation != oldMaterialAssociation) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OBSLPackage.MATERIAL_ASSOCIATION_LINK__MATERIAL_ASSOCIATION, oldMaterialAssociation, materialAssociation));
			}
		}
		return materialAssociation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MaterialAssociation basicGetMaterialAssociation() {
		return materialAssociation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaterialAssociation(MaterialAssociation newMaterialAssociation) {
		MaterialAssociation oldMaterialAssociation = materialAssociation;
		materialAssociation = newMaterialAssociation;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OBSLPackage.MATERIAL_ASSOCIATION_LINK__MATERIAL_ASSOCIATION, oldMaterialAssociation, materialAssociation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RoleIndividual getEnd1() {
		if (end1 != null && end1.eIsProxy()) {
			InternalEObject oldEnd1 = (InternalEObject)end1;
			end1 = (RoleIndividual)eResolveProxy(oldEnd1);
			if (end1 != oldEnd1) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OBSLPackage.MATERIAL_ASSOCIATION_LINK__END1, oldEnd1, end1));
			}
		}
		return end1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RoleIndividual basicGetEnd1() {
		return end1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEnd1(RoleIndividual newEnd1) {
		RoleIndividual oldEnd1 = end1;
		end1 = newEnd1;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OBSLPackage.MATERIAL_ASSOCIATION_LINK__END1, oldEnd1, end1));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RoleIndividual getEnd2() {
		if (end2 != null && end2.eIsProxy()) {
			InternalEObject oldEnd2 = (InternalEObject)end2;
			end2 = (RoleIndividual)eResolveProxy(oldEnd2);
			if (end2 != oldEnd2) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OBSLPackage.MATERIAL_ASSOCIATION_LINK__END2, oldEnd2, end2));
			}
		}
		return end2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RoleIndividual basicGetEnd2() {
		return end2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEnd2(RoleIndividual newEnd2) {
		RoleIndividual oldEnd2 = end2;
		end2 = newEnd2;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OBSLPackage.MATERIAL_ASSOCIATION_LINK__END2, oldEnd2, end2));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__MATERIAL_ASSOCIATION:
				if (resolve) return getMaterialAssociation();
				return basicGetMaterialAssociation();
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END1:
				if (resolve) return getEnd1();
				return basicGetEnd1();
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END2:
				if (resolve) return getEnd2();
				return basicGetEnd2();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__MATERIAL_ASSOCIATION:
				setMaterialAssociation((MaterialAssociation)newValue);
				return;
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END1:
				setEnd1((RoleIndividual)newValue);
				return;
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END2:
				setEnd2((RoleIndividual)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__MATERIAL_ASSOCIATION:
				setMaterialAssociation((MaterialAssociation)null);
				return;
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END1:
				setEnd1((RoleIndividual)null);
				return;
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END2:
				setEnd2((RoleIndividual)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__MATERIAL_ASSOCIATION:
				return materialAssociation != null;
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END1:
				return end1 != null;
			case OBSLPackage.MATERIAL_ASSOCIATION_LINK__END2:
				return end2 != null;
		}
		return super.eIsSet(featureID);
	}

} //MaterialAssociationLinkImpl
